import app
import requests


class DepartmentApi:
    def __init__(self):
        self.login_url = app.BASE_URL + "/api/sys/login"

    def login(self, jsonData):
        return requests.post(url=self.login_url, json=jsonData)

    def add_department(self, jsonData):
        self.add_url = app.BASE_URL + "/api/company/department"
        return requests.post(url=self.add_url, json=jsonData, headers=app.HEADERS)

    def query_department(self, emp_id):
        self.query_api = app.BASE_URL + "/api/company/department" + "/" + emp_id
        return requests.get(url=self.query_api, headers=app.HEADERS)

    def modify_department(self, emp_id, jsonData):
        self.modify_api = app.BASE_URL + "/api/company/department" + "/" + emp_id
        return requests.put(url=self.modify_api, json=jsonData, headers=app.HEADERS)

    def delete_department(self, emp_id):
        self.delete_url = app.BASE_URL + "/api/company/department" + "/" + emp_id
        return requests.delete(url=self.query_api, headers=app.HEADERS)
